package com.lanmaoly.web.config;

import com.lanmaoly.web.server.pojo.TbPayLog;
import com.lanmaoly.web.server.pojo.group.Cart;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class DataCenter {

    private static final Map<Long, List<Map>> BRAND_LIST = new ConcurrentHashMap<>(1024);

    public static Map<Long, List<Map>> getBrandList() {
        return BRAND_LIST;
    }

    public static void brandListPut(Long id, List<Map> list) {
        BRAND_LIST.put(id, list);
    }

    private static final Map<Long, List<Map>> SPEC_LIST = new ConcurrentHashMap<>(1024);

    public static Map<Long, List<Map>> getSpecList() {
        return SPEC_LIST;
    }

    public static void specListPut(Long id, List<Map> list) {
        SPEC_LIST.put(id, list);
    }

    private static final Map<String, Long> ITEM_CAT = new ConcurrentHashMap<>(1024);

    public static Map<String, Long> getItemCat() {
        return ITEM_CAT;
    }

    public static void itemCatPut(String name, Long typeId) {
        ITEM_CAT.put(name, typeId);
    }

    /**
     * 购物车
     */
    private static final Map<String, List<Cart>> CART_LIST = new ConcurrentHashMap<>(16);

    public static Map<String, List<Cart>> getCartList() {
        return CART_LIST;
    }

    public static void cartListPut(String username, List<Cart> list) {
        CART_LIST.put(username, list);
    }

    private static final Map<String, TbPayLog> TB_PAY_LOG_MAP = new ConcurrentHashMap<>(16);

    public static void putPayLog(String userId, TbPayLog payLog) {
        TB_PAY_LOG_MAP.put(userId, payLog);
    }

    public static Map<String, TbPayLog> getTbPayLogMap() {
        return TB_PAY_LOG_MAP;
    }
}
